#!/bin/sh
nginx_proc_num=$(ps -ef | grep '[n]ginx' | wc -l)
if [ $nginx_proc_num -eq 0 ]; then
    nginx
    sleep 3
    if [ $nginx_proc_num -eq 0 ]; then
        systemctl stop keepalived
    fi
fi 